/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calculator.entities;

import exceptions.DivideByZeroException;

/**
 *
 * @author Dargor
 */
public abstract class MathEntity extends Object implements IMathEntity{
    public IMathEntity doAction(String action, IMathEntity operand) throws DivideByZeroException
    {
        if(action.equals("*"))
            return this.multiply(operand);
        if(action.equals("+"))
            return this.add(operand);
        if(action.equals("-"))
            return this.substract(operand);
        if(action.equals("/"))
            return this.divide(operand);
        return null;
    }
}
